package com.example.administrator.nl.adapter;

import android.support.annotation.Nullable;
import android.widget.TextView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseSectionQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.example.administrator.nl.R;
import com.example.administrator.nl.bean.CommodityBean;

import java.util.List;

public class CommodityAdapter extends BaseSectionQuickAdapter<CommodityBean, BaseViewHolder> {


    /**
     * Same as QuickAdapter#QuickAdapter(Context,int) but with
     * some initialization data.
     *
     * @param layoutResId      The layout resource id of each item.
     * @param sectionHeadResId The section head layout id for each item
     * @param data             A new list is created out of this one to avoid mutable list
     */
    public CommodityAdapter(int layoutResId, int sectionHeadResId, List<CommodityBean> data) {
        super(layoutResId, sectionHeadResId, data);
    }

    @Override
    protected void convertHead(BaseViewHolder helper, CommodityBean item) {
        TextView item_title =helper.getView(R.id.item_title);
        TextView item_more =helper.getView(R.id.item_more);
        item_title.setText(item.getHeadTitle());
        item_more.setText(item.getMoreTitle());
    }

    @Override
    protected void convert(BaseViewHolder helper, CommodityBean item) {
        TextView tv_shopping =helper.getView(R.id.tv_shopping);
        TextView tv_money =helper.getView(R.id.tv_money);
        TextView tv_number =helper.getView(R.id.tv_number);
        tv_shopping.setText(item.t.getTitle());
        tv_money.setText(item.t.money);
        tv_number.setText(item.t.number);
    }
}
